



export default class Queue<T = any> {
	private data: T[] = [];

	constructor(data: T[] = []) {
		this.data = data;
	}

	enqueue(element: T): void {
		this.data.push(element);
	}

	dequeue(): T | undefined {
		return this.data.shift();
	}

	peek(): T | undefined {
		return this.data[0];
	}

	isEmpty(): boolean {
		return this.data.length === 0;
	}

	size(): number {
		return this.data.length;
	}
}